package routes

import (
	"Godzilla/controllers"
	"Godzilla/middleware"
	"github.com/labstack/echo/v4"
)


func UserGroupRoute(e *echo.Group) {

	e.POST("/", controllers.SaveUser)
	//e.GET("/:id", controllers.GetUser, middleware.CalHandleTime)
	//e.GET("/:id", controllers.GetUser, middleware.Auth())
	e.GET("/:id", controllers.GetUser, middleware.Auth(), middleware.Rbac())
	e.PUT("/:id", controllers.UpdateUser)
	e.DELETE("/:id", controllers.DeleteUser)
	e.POST("/users", controllers.GetUsers)
}

func RoleGroupRoute(e *echo.Group) {
	e.POST("/", controllers.SaveRole)
	e.GET("/:id", controllers.GetRole)
	e.PUT("/:id", controllers.UpdateRole)
	e.DELETE("/:id", controllers.DeleteRole)
	e.POST("/roles", controllers.GetRoles)
}

func RouterGroupRoute(e *echo.Group) {
	e.POST("/", controllers.SaveRouter)
	e.GET("/:id", controllers.GetRouter)
	e.PUT("/:id", controllers.UpdateRouter)
	e.DELETE("/:id", controllers.DeleteRouter)
	e.POST("/routers", controllers.GetRouters)
}

func UserRoleGroupRoute(e *echo.Group) {
	e.POST("/", controllers.SaveUserRole)
	e.GET("/:id", controllers.GetUserRole)
	e.PUT("/:id", controllers.UpdateUserRole)
	e.DELETE("/:id", controllers.DeleteUserRole)
	e.POST("/all", controllers.GetUserRoles)
}

func RoleRouterGroupRoute(e *echo.Group)  {
	e.POST("/", controllers.SaveRoleRouter)
	e.GET("/:id", controllers.GetRoleRouter)
	e.PUT("/:id", controllers.UpdateRoleRouter)
	e.DELETE("/:id", controllers.DeleteRoleRouter)
	e.POST("/all", controllers.GetRoleRouters)
}